﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZhimeiSoft.Framework.Client.Base;

using ZhimeiSoft.CharmManager.Client.App;
using ZhimeiSoft.CharmManager.Client.Forms.Control.Custom;
using ZhimeiSoft.CharmManager.Client.Manager;
using ZhimeiSoft.CharmManager.Interface;

namespace ZhimeiSoft.CharmManager.Client.Forms
{
    public partial class CustomInfoView : BaseUserControl
    {
        /// <summary>
        /// 会员信息
        /// </summary>
        private DataTable dtCustomInfo = new DataTable();
        /// <summary>
        /// 店信息
        /// </summary>
        private DataSet dsSalon = new DataSet();

        public CustomInfoView()
        {
            InitializeComponent();
        }

        public CustomInfoView(CharmManagerApp _app)
            : base(_app) 
        {
            InitializeComponent();
            customInfoSearch.onSerchCustom = this.serchCustomInfo;
            customInfo.EventRefershCustomInfoData = this.refershCustomInfoData;
            string error = string.Empty;
            BussinessProxyManager.Instance.QuerySalonInfo(out dsSalon, out error);
            
        }

        /// <summary>
        /// 搜索会员控件返回的会员信息
        /// </summary>
        /// <param name="drCustomInfo"></param>
        private void serchCustomInfo(DataRow drCustomInfo)
        {
            if (drCustomInfo == null)
            {
                return;
            }
           
            dtCustomInfo = drCustomInfo.Table.Clone();
            dtCustomInfo.ImportRow(drCustomInfo);
            customInfo.CustomInfoData = dtCustomInfo;
        }
        /// <summary>
        /// 回调函数触发刷新数据集操作
        /// </summary>
        private void refershCustomInfoData()
        {
            string error = string.Empty;
            customInfoSearch.refershCustomInfo(out error);
        }
    }
}
